﻿
#include "ros_support_base.h"

namespace spadas
{
    struct RosFileIOWriteMessageObjectData
    {
        String fileName;
        Double time;
        String topic;
        String dataType;
        String md5Sum;
        String definition;
        Binary binaryData;
        Bool writeToGeneration;
        Bool sideWriter;
    };

    enum class RosFileIOWriteMessageObjectField
    {
        FileName = 0,
        Time = 1,
        Topic = 2,
        DataType = 3,
        MD5Sum = 4,
        Definition = 5,
        BinaryData = 6,
        WriteToGeneration = 7,
        SideWriter = 8,
    };

    class RosFileIOWriteMessageObjectVars : public FlexVars<RosFileIOWriteMessageObjectData>
    {
    public:
        SPADAS_VARS(RosFileIOWriteMessageObject, FlexVars<RosFileIOWriteMessageObjectData>);
        RosFileIOWriteMessageObjectVars() : FlexVars<RosFileIOWriteMessageObjectData>(
            Array<Int>::create(9
            ,RosFileIOWriteMessageObjectField::FileName
            ,RosFileIOWriteMessageObjectField::Time
            ,RosFileIOWriteMessageObjectField::Topic
            ,RosFileIOWriteMessageObjectField::DataType
            ,RosFileIOWriteMessageObjectField::MD5Sum
            ,RosFileIOWriteMessageObjectField::Definition
            ,RosFileIOWriteMessageObjectField::BinaryData
            ,RosFileIOWriteMessageObjectField::WriteToGeneration
            ,RosFileIOWriteMessageObjectField::SideWriter
            )) {}
    };
}

namespace spadas
{
    struct RosFileIORegisterReadStreamObjectData
    {
        Bool readFromGeneration;
        String fileName;
        String topic;
        Stream<RosFileIOReadMessage> readStream;
    };

    enum class RosFileIORegisterReadStreamObjectField
    {
        ReadFromGeneration = 0,
        FileName = 1,
        Topic = 2,
        ReadStream = 3,
    };

    class RosFileIORegisterReadStreamObjectVars : public FlexVars<RosFileIORegisterReadStreamObjectData>
    {
    public:
        SPADAS_VARS(RosFileIORegisterReadStreamObject, FlexVars<RosFileIORegisterReadStreamObjectData>)
        RosFileIORegisterReadStreamObjectVars() : FlexVars<RosFileIORegisterReadStreamObjectData>(
            Array<Int>::create(4
            ,RosFileIORegisterReadStreamObjectField::ReadFromGeneration
            ,RosFileIORegisterReadStreamObjectField::FileName
            ,RosFileIORegisterReadStreamObjectField::Topic
            ,RosFileIORegisterReadStreamObjectField::ReadStream
            )) {}
    };
}

using namespace spadas;

RosFileIOWriteMessageObject::RosFileIOWriteMessageObject() : Object<RosFileIOWriteMessageObjectVars>(new RosFileIOWriteMessageObjectVars, TRUE)
{}

String RosFileIOWriteMessageObject::getFileName()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::FileName)) return vars->cast().fileName;
    else return "";
}
void RosFileIOWriteMessageObject::setFileName(String val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::FileName)) vars->cast().fileName = val;
}
Double RosFileIOWriteMessageObject::getTime()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Time)) return vars->cast().time;
    else return 0;
}
void RosFileIOWriteMessageObject::setTime(Double val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Time)) vars->cast().time = val;
}
String RosFileIOWriteMessageObject::getTopic()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Topic)) return vars->cast().topic;
    else return "";
}
void RosFileIOWriteMessageObject::setTopic(String val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Topic)) vars->cast().topic = val;
}
String RosFileIOWriteMessageObject::getDataType()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::DataType)) return vars->cast().dataType;
    else return "";
}
void RosFileIOWriteMessageObject::setDataType(String val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::DataType)) vars->cast().dataType = val;
}
String RosFileIOWriteMessageObject::getMD5Sum()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::MD5Sum)) return vars->cast().md5Sum;
    else return "";
}
void RosFileIOWriteMessageObject::setMD5Sum(String val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::MD5Sum)) vars->cast().md5Sum = val;
}
String RosFileIOWriteMessageObject::getDefinition()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Definition)) return vars->cast().definition;
    else return "";
}
void RosFileIOWriteMessageObject::setDefinition(String val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::Definition)) vars->cast().definition = val;
}
Binary RosFileIOWriteMessageObject::getBinaryData()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::BinaryData)) return vars->cast().binaryData;
    else return Binary();
}
void RosFileIOWriteMessageObject::setBinaryData(Binary val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::BinaryData)) vars->cast().binaryData = val;
}
Bool RosFileIOWriteMessageObject::getWriteToGeneration()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::WriteToGeneration)) return vars->cast().writeToGeneration;
    else return FALSE;
}
void RosFileIOWriteMessageObject::setWriteToGeneration(Bool val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::WriteToGeneration)) vars->cast().writeToGeneration = val;
}
Bool RosFileIOWriteMessageObject::getSideWriter()
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::SideWriter)) return vars->cast().sideWriter;
    else return FALSE;
}
void RosFileIOWriteMessageObject::setSideWriter(Bool val)
{
    if (vars->has((Int)RosFileIOWriteMessageObjectField::SideWriter)) vars->cast().sideWriter = val;
}

RosFileIORegisterReadStreamObject::RosFileIORegisterReadStreamObject() : Object<RosFileIORegisterReadStreamObjectVars>(new RosFileIORegisterReadStreamObjectVars, TRUE)
{}

Bool RosFileIORegisterReadStreamObject::getReadFromGeneration()
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::ReadFromGeneration)) return vars->cast().readFromGeneration;
    else return FALSE;
}
void RosFileIORegisterReadStreamObject::setReadFromGeneration(Bool val)
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::ReadFromGeneration)) vars->cast().readFromGeneration = val;
}
String RosFileIORegisterReadStreamObject::getFileName()
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::FileName)) return vars->cast().fileName;
    else return FALSE;
}
void RosFileIORegisterReadStreamObject::setFileName(String val)
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::FileName)) vars->cast().fileName = val;
}
String RosFileIORegisterReadStreamObject::getTopic()
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::Topic)) return vars->cast().topic;
    else return FALSE;
}
void RosFileIORegisterReadStreamObject::setTopic(String val)
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::Topic)) vars->cast().topic = val;
}
Stream<RosFileIOReadMessage> RosFileIORegisterReadStreamObject::getReadStream()
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::ReadStream)) return vars->cast().readStream;
    else return FALSE;
}
void RosFileIORegisterReadStreamObject::setReadStream(Stream<RosFileIOReadMessage> val)
{
    if (vars->has((Int)RosFileIORegisterReadStreamObjectField::ReadStream)) vars->cast().readStream = val;
}